package de.pierrepoenisch.checkyoursite.tests.ClientTests;
import junit.framework.TestCase;
import de.pierrepoenisch.checkyoursite.client.CheckResult;
import de.pierrepoenisch.checkyoursite.client.CheckResultStateET;


public class CheckResultTest extends TestCase {

	protected void setUp() throws Exception {
	}

	protected void tearDown() throws Exception {
	}

	public void testCheckResult() {
		CheckResult cr = new CheckResult();
		assertNotNull(cr);
	}

	//referenced by testSetURI()
	public void testGetURI() {
		//test with a string
		CheckResult cr = new CheckResult();
		cr.setURI("testURI");
		assertEquals("testURI", cr.getURI());
		
		//test with null
		cr.setURI(null);
		assertNull(cr.getURI());		
	}

	public void testSetURI() {
		//see testGetURI()
	}

	public void testGetSiteSizeKB() {
		CheckResult cr = new CheckResult();
		cr.setSiteSizeKB(100.123);
		assertEquals(100.123, cr.getSiteSizeKB(),0);		
		cr.setSiteSizeKB(Double.MAX_VALUE);
		assertEquals(Double.MAX_VALUE, cr.getSiteSizeKB(),0);
		
		cr.setSiteSizeKB(Double.MIN_VALUE);
		assertEquals(Double.MIN_VALUE, cr.getSiteSizeKB(),0);
	}

	//see testGetSiteSizeKB()
	public void testSetSiteSizeKB() {
	}

	//referenced by testSetReferredFilesCheckResult()
	public void testGetReferredFilesCheckResult() {
		CheckResult cr = new CheckResult();
		CheckResult[] crArray = new CheckResult[10];
		
		for (int i=0; i< 10; i++){
			crArray[i]= new CheckResult();
		}
		
		cr.setReferredFilesCheckResult(crArray);
		assertEquals(crArray, cr.getReferredFilesCheckResult());
	}

	//see testGetReferredFilesCheckResult()
	public void testSetReferredFilesCheckResult() {
	}

	//referenced by testSetTimeInSec()
	public void testGetTimeInSec() {
		CheckResult cr = new CheckResult();
		cr.setTimeInSec(123.345);
		assertEquals(123.345, cr.getTimeInSec(),0);
		
		cr.setTimeInSec(Double.MAX_VALUE);
		assertEquals(Double.MAX_VALUE, cr.getTimeInSec(),0);

		cr.setTimeInSec(Double.MIN_VALUE);
		assertEquals(Double.MIN_VALUE, cr.getTimeInSec(),0);
	}

	//see testGetTimeInSec() 
	public void testSetTimeInSec() {
	}

	//referenced by testSetState()
	public void testGetState() {
		CheckResult cr = new CheckResult();
		cr.setState(CheckResultStateET.NOK);
		assertEquals(CheckResultStateET.NOK, cr.getState());

		cr.setState(CheckResultStateET.OK);
		assertEquals(CheckResultStateET.OK, cr.getState());

		cr.setState(null);
		assertNull(cr.getState());
	}

	//see testGetState()
	public void testSetState() {
	}
}
